<div class="maintop">
    当前位置：系统权限控制列表
    <a href="javascript:;" action="/sys/usergroup" class="mainFrame button">返回</a>
    <a href="javascript:;" action="<?=$basepath?>" class="mainFrame button">刷新</a>
    <? if(ISDEBUG){ ?>
        <a href="javascript:$('.debuginfo').toggle();" class="button">调试信息</a>
    <? } ?>
</div>
<div class="search-body">
    <div class="main-search">
        <table width="100%">
            <tbody><tr>
                <td>
                    <label for="selectAllid"><input type="checkbox" value="1" id="selectAllid"  /> 全选 / 取消全选</label>
                    <a href="javascript:;" id="usergroup_setting_save" class="upbutton icon-ok">保存<a>
                </td>
            </tr>
            </tbody>
        </table>
</div>
<div id="mainbody">
    <table width="100%" class="tablist">
        <? $user_auths = '0,'.$groupdata['auths'];
            foreach($datas as $m){ ?>
                <tr class="trbg"><td colspan="6" class="tdleft icon-sitemap"><?=$m['title'] ?></td></tr>
                <? foreach($m['sub'] as $k=>$v){
                    $ki = $k + 1;
                    if($ki % 2 != 0) echo '<tr>';
                    ?>
                    <td width="30"><input type="checkbox" name="selectValue" value="<?=$v['id']?>" <?=(strpos($user_auths,$v['id'])==true ? 'checked="checked"' : '')?> /></td>
                    <td class="tdleft"><?=$v['id']?> - <?=$v['title']?> [<?=$v['action']?>]</td>
                <?
                        if($ki % 2 == 0) echo '</tr>';
                    }
                ?>
            <? } ?>
    </table>
</div>
    <script>
        $(document).ready(function () {
           $("#usergroup_setting_save").bind("click",function () {
               var _selectId = "";
               var arrChk=$(".tablist input[name=selectValue]:checked");
               $(arrChk).each(function(){
                   _selectId += ',' + this.value;
               });
               _selectId = _selectId.substr(1,_selectId.length-1);
               if(_selectId.length<=0){
                   $.error("没有选择任何权限");
                   return false;
               }
               var _data = {
                   ids : _selectId,
                   groupid : '<?=$groupdata['id']?>',
               };
               ajaxpostdata("<?=$basepath?>_save",_data)
           });
        });
        </script>
